package com.cdtu.controller;

import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.ServletRequestDataBinder;
import org.springframework.web.bind.annotation.InitBinder;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author : Sakura
 * @Date : 2023/8/9 21:12
 * @Description : TODO
 */
@Controller
public class BaseController {
    @InitBinder
    public void initBinder(ServletRequestDataBinder servletRequestDataBinder) {
        servletRequestDataBinder.registerCustomEditor(Date.class,
                new CustomDateEditor(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm"), true));
    }

}
